home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / graphic / frasr182.zip / FRACTINT.FRM < prev    next >
Text File  |  1993-05-19  |  16KB  |  664 lines

  1. comment {
  2.  FRACTINT.DOC has instructions for adding new formulas to this file.
  3.  There are several hard-coded restrictions in the formula interpreter:
  4.  
  5.  1) The fractal name through the open curly bracket must be on a single line.
  6.  2) There is a hard-coded limit of 200 formulas per formula file, only
  7.     because of restrictions in the prompting routines.
  8.  3) Formulas can containt at most 250 operations (references to variables and
  9.     arithmetic); this is bigger than it sounds, no formula in the default
  10.     fractint.frm uses even 100
  11.  3) Comment blocks can be set up using dummy formulas with no formula name
  12.     or with the special name "comment".
  13.  
  14.  The formulas at the beginning of this file are from Mark Peterson, who
  15.  built this fractal interpreter feature.  The rest are grouped by contributor.
  16.  (Scott Taylor sent many but they are no longer here - they've been
  17.  incorporated as hard-coded types.  Lee Skinner also sent many which have
  18.  now been hard-coded.)
  19.  
  20.  Note that the builtin "cos" function had a bug which was corrected in
  21.  version 16.  To recreate an image from a formula which used cos before
  22.  v16, change "cos" in the formula to "cosxx" which is a new function
  23.  provided for backward compatibility with that bug.
  24.  }
  25.  
  26. Mandelbrot(XAXIS) {; Mark Peterson
  27.   ; Classical fractal showing LastSqr speedup
  28.   z = Pixel, z = Sqr(z):  ; Start with z**2 to initialize LastSqr
  29.    z = z + Pixel
  30.    z = Sqr(z)
  31.     LastSqr <= 4      ; Use LastSqr instead of recalculating
  32.   }
  33.  
  34. Dragon (ORIGIN) {; Mark Peterson
  35.   z = Pixel:
  36.    z = sqr(z) + (-0.74543, 0.2),
  37.     |z| <= 4
  38.   }
  39.  
  40. Daisy (ORIGIN) {; Mark Peterson
  41.   z = pixel:
  42.    z = z*z + (0.11031, -0.67037),
  43.     |z| <= 4
  44.   }
  45.  
  46. InvMandel (XAXIS) {; Mark Peterson
  47.   c = z = 1 / pixel:
  48.    z = sqr(z) + c;
  49.     |z| <= 4
  50.   }
  51.  
  52. DeltaLog(XAXIS) {; Mark Peterson
  53.   z = pixel, c = log(pixel):
  54.    z = sqr(z) + c,
  55.     |z| <= 4
  56.   }
  57.  
  58. Newton4(XYAXIS) {; Mark Peterson
  59.   ; Note that floating-point is required to make this compute accurately
  60.   z = pixel, Root = 1:
  61.    z3 = z*z*z;
  62.    z4 = z3 * z;
  63.    z = (3 * z4 + Root) / (4 * z3);
  64.     .004 <= |z4 - Root|
  65.   }
  66.  
  67. comment {
  68.    The following are from Chris Green:
  69.    These fractals all use Newton's or Halley's formula for approximation
  70.    of a function.  In all of these fractals, p1 real is the "relaxation
  71.    coefficient". A value of 1 gives the conventional newton or halley
  72.    iteration. Values <1 will generally produce less chaos than values >1.
  73.    1-1.5 is probably a good range to try.  P1 imag is the imaginary component
  74.    of the relaxation coefficient, and should be zero but maybe a small
  75.    non-zero value will produce something interesting. Who knows?
  76.    For more information on Halley maps, see "Computers, Pattern, Chaos,
  77.    and Beauty" by Pickover.
  78.    }
  79.  
  80. Halley (XYAXIS) {; Chris Green. Halley's formula applied to x^7-x=0.
  81.   ; P1 real usually 1 to 1.5, P1 imag usually zero. Use floating point.
  82.   ; Setting P1 to 1 creates the picture on page 277 of Pickover's book
  83.   z=pixel:
  84.    z5=z*z*z*z*z;
  85.    z6=z*z5;
  86.    z7=z*z6;
  87.    z=z-p1*((z7-z)/ ((7.0*z6-1)-(42.0*z5)*(z7-z)/(14.0*z6-2))),
  88.     0.0001 <= |z7-z|
  89.   }
  90.  
  91. CGhalley (XYAXIS) {; Chris Green -- Halley's formula
  92.   ; P1 real usually 1 to 1.5, P1 imag usually zero. Use floating point.
  93.   z=(1,1):
  94.    z5=z*z*z*z*z;
  95.    z6=z*z5;
  96.    z7=z*z6;
  97.    z=z-p1*((z7-z-pixel)/ ((7.0*z6-1)-(42.0*z5)*(z7-z-pixel)/(14.0*z6-2))),
  98.     0.0001 <= |z7-z-pixel|
  99.   }
  100.  
  101. halleySin (XYAXIS) {; Chris Green. Halley's formula applied to sin(x)=0.
  102.   ; Use floating point.
  103.   ; P1 real = 0.1 will create the picture from page 281 of Pickover's book.
  104.   z=pixel:
  105.    s=sin(z), c=cos(z)
  106.    z=z-p1*(s/(c-(s*s)/(c+c))),
  107.     0.0001 <= |s|
  108.   }
  109.  
  110. NewtonSinExp (XAXIS) {; Chris Green
  111.   ; Newton's formula applied to sin(x)+exp(x)-1=0.
  112.   ; Use floating point.
  113.   z=pixel:
  114.    z1=exp(z)
  115.    z2=sin(z)+z1-1
  116.    z=z-p1*z2/(cos(z)+z1),
  117.     .0001 < |z2|
  118.   }
  119.  
  120. CGNewton3 {; Chris Green -- A variation on newton iteration.
  121.   ; The initial guess is fixed at (1,1), but the equation solved
  122.   ; is different at each pixel ( x^3-pixel=0 is solved).
  123.   ; Use floating point.
  124.   ; Try P1=1.8.
  125.   z=(1,1):
  126.    z2=z*z;
  127.    z3=z*z2;
  128.    z=z-p1*(z3-pixel)/(3.0*z2),
  129.     0.0001 < |z3-pixel|
  130.   }
  131.  
  132. HyperMandel {; Chris Green.
  133.   ; A four dimensional version of the mandelbrot set.
  134.   ; Use P1 to select which two-dimensional plane of the
  135.   ; four dimensional set you wish to examine.
  136.   ; Use floating point.
  137.   a=(0,0),b=(0,0):
  138.    z=z+1
  139.    anew=sqr(a)-sqr(b)+pixel
  140.    b=2.0*a*b+p1
  141.    a=anew,
  142.     |a|+|b| <= 4
  143.   }
  144.  
  145.  
  146. MTet (XAXIS) {; Mandelbrot form 1 of the Tetration formula --Lee Skinner
  147.   z = pixel:
  148.    z = (pixel ^ z) + pixel,
  149.     |z| <= (P1 + 3)
  150.   }
  151.  
  152. AltMTet(XAXIS) {; Mandelbrot form 2 of the Tetration formula --Lee Skinner
  153.   z = 0:
  154.    z = (pixel ^ z) + pixel,
  155.     |z| <= (P1 + 3)
  156.   }
  157.  
  158. JTet (XAXIS) {; Julia form 1 of the Tetration formula --Lee Skinner
  159.   z = pixel:
  160.    z = (pixel ^ z) + P1,
  161.     |z| <= (P2 + 3)
  162.   }
  163.  
  164. AltJTet (XAXIS) {; Julia form 2 of the Tetration formula --Lee Skinner
  165.   z = P1:
  166.    z = (pixel ^ z) + P1,
  167.     |z| <= (P2 + 3)
  168.   }
  169.  
  170. Cubic (XYAXIS) {; Lee Skinner
  171.   p = pixel, test = p1 + 3,
  172.   t3 = 3*p, t2 = p*p,
  173.   a = (t2 + 1)/t3, b = 2*a*a*a + (t2 - 2)/t3,
  174.   aa3 = a*a*3, z = 0 - a :
  175.    z = z*z*z - aa3*z + b,
  176.     |z| < test
  177.  }
  178.  
  179. { The following are from Lee Skinner, have been partially generalized. }
  180.  
  181. Fzppfnre  {; Lee Skinner
  182.   z = pixel, f = 1./(pixel):
  183.    z = fn1(z) + f,
  184.     |z| <= 50
  185.   }
  186.  
  187. Fzppfnpo  {; Lee Skinner
  188.   z = pixel, f = (pixel)^(pixel):
  189.    z = fn1(z) + f,
  190.     |z| <= 50
  191.   }
  192.  
  193. Fzppfnsr  {; Lee Skinner
  194.   z = pixel, f = (pixel)^.5:
  195.    z = fn1(z) + f,
  196.     |z| <= 50
  197.   }
  198.  
  199. Fzppfnta  {; Lee Skinner
  200.   z = pixel, f = tan(pixel):
  201.    z = fn1(z) + f,
  202.     |z|<= 50
  203.   }
  204.  
  205. Fzppfnct  {; Lee Skinner
  206.   z = pixel, f = cos(pixel)/sin(pixel):
  207.    z = fn1(z) + f,
  208.     |z|<= 50
  209.   }
  210.  
  211. Fzppfnse  {; Lee Skinner
  212.   z = pixel, f = 1./sin(pixel):
  213.    z = fn1(z) + f,
  214.     |z| <= 50
  215.   }
  216.  
  217. Fzppfncs  {; Lee Skinner
  218.   z = pixel, f = 1./cos(pixel):
  219.    z = fn1(z) + f,
  220.     |z| <= 50
  221.   }
  222.  
  223. Fzppfnth  {; Lee Skinner
  224.   z = pixel, f = tanh(pixel):
  225.    z = fn1(z)+f,
  226.     |z|<= 50
  227.   }
  228.  
  229. Fzppfnht  {; Lee Skinner
  230.   z = pixel, f = cosh(pixel)/sinh(pixel):
  231.    z = fn1(z)+f,
  232.     |z|<= 50
  233.   }
  234.  
  235. Fzpfnseh  {; Lee Skinner
  236.   z = pixel, f = 1./sinh(pixel):
  237.    z = fn1(z) + f,
  238.     |z| <= 50
  239.   }
  240.  
  241. Fzpfncoh  {; Lee Skinner
  242.   z = pixel, f = 1./cosh(pixel):
  243.    z = fn1(z) + f,
  244.     |z| <= 50
  245.   }
  246.  
  247.  
  248. { The following resulted from a FRACTINT bug. Version 13 incorrectly
  249.   calculated Spider (see above). We fixed the bug, and reverse-engineered
  250.   what it was doing to Spider - so here is the old "spider" }
  251.  
  252. Wineglass(XAXIS) {; Pieter Branderhorst
  253.   c = z = pixel:
  254.    z = z * z + c
  255.    c = (1+flip(imag(c))) * real(c) / 2 + z,
  256.     |z| <= 4 }
  257.  
  258.  
  259. { The following is from Scott Taylor.
  260.   Scott says they're "Dog" because the first one he looked at reminded him
  261.   of a hot dog. This was originally several fractals, we have generalized it. }
  262.  
  263. FnDog(XYAXIS)  {; Scott Taylor
  264.   z = Pixel, b = p1+2:
  265.    z = fn1( z ) * pixel,
  266.     |z| <= b
  267.   }
  268.  
  269. Ent {; Scott Taylor
  270.   ; Try params=.5/.75 and the first function as exp.
  271.   ; Zoom in on the swirls around the middle.  There's a
  272.   ; symmetrical area surrounded by an asymmetric area.
  273.   z = Pixel, y = fn1(z), base = log(p1):
  274.    z = y * log(z)/base,
  275.     |z| <= 4
  276.   }
  277.  
  278. Ent2 {; Scott Taylor
  279.   ; try params=2/1, functions=cos/cosh, potential=255/355
  280.   z = Pixel, y = fn1(z), base = log(p1):
  281.    z = fn2( y * log(z) / base ),
  282.     |z| <= 4
  283.   }
  284.  
  285. { From Kevin Lee: }
  286.  
  287. LeeMandel1(XYAXIS) {; Kevin Lee
  288.   z=Pixel:
  289. ;; c=sqr(pixel)/z, c=z+c, z=sqr(z),  this line was an error in v16
  290.    c=sqr(pixel)/z, c=z+c, z=sqr(c),
  291.     |z|<4
  292.   }
  293.  
  294. LeeMandel2(XYAXIS) {; Kevin Lee
  295.   z=Pixel:
  296.    c=sqr(pixel)/z, c=z+c, z=sqr(c*pixel),
  297.     |z|<4
  298.    }
  299.  
  300. LeeMandel3(XAXIS) {; Kevin Lee
  301.   z=Pixel, c=Pixel-sqr(z):
  302.    c=Pixel+c/z, z=c-z*pixel,
  303.     |z|<4
  304.   }
  305.  
  306. { These are a few of the examples from the book,
  307.   Fractal Creations, by Tim Wegner and Mark Pe